<?php


namespace frontend\facade;


use yii\base\InvalidConfigException;
use yii\di\Instance;

class BaseFacade
{
    /**
     * @return object|string|array|static
     * @throws InvalidConfigException
     */
    public static function getFacadeAccessor()
    {
        throw new InvalidConfigException('Facade does not implement getFacadeAccessor method');
    }

    /**
     * @param $name
     * @param $arguments
     * @return mixed
     * @throws InvalidConfigException
     */
    public static function __callStatic($name, $arguments)
    {
        $server = Instance::ensure(static::getFacadeAccessor());
        return call_user_func_array([$server, $name], $arguments);
    }
}